GetItemCmd
GetItemCmd Query current command character of a menu item MenuHandle theMenu ; handle of menu containing item of inquiry short whichItem ; ID of an item in theMenu
short *cmdChar ; receives current command char; 0=none
GetItemCmd copies the command character of a selected menu item into the caller's variable. A command character is normally assigned when a menu
item text containing a metacharacter of /". It is the command-key code that
is assigned to a menu item (as obtained via MenuKey). theMenu is a handle leading to a variable-length MenuInfo structure. It identifies the menu containing the item whose command character
you wish to obtain.
whichItem identifies which item in menu theMenu to query. Items are
numbered sequentially with the topmost item having an ID of 1.
cmdChar is the address of a 2-byte buffer. Upon return, the byte will
contain the ASCII value of the current command character. If the
return value is hMenuCmd (0x1B), the menu item has a submenu. A
returned value of 0 indicates that no command character is currently
assigned.
The designation as a short* is not a typo. Pascal CHAR data types
are actually 16-bit words. Using a 1-byte char variable will cause
the Menu Manager to overwrite the next higher byte in memory.
Notes: GetItemCmd is new with the 256K ROMs and might be handy for working with hierarchical menu systems. If the value returned in cmdChar is
0x1B, you may use GetItemMark to learn the ID of the submenu associated with item whichItem.
Most applications, having defined each menu internally, will already know
the command key equivalent of each menu item; therefore, this function is
needed rarely.